package gof_001_创建型_Create.gof_001_单例_Singleton.gof_005_StaticInnerClass;

public class Student {
    private Student(){
    }

    //当外部调用该方法时,会加载内部类,起到延迟加载
    public static Student getInstance() {
        //因为是内部类的静态常量,可以直接调用
        Student student = Inner.STUDENT;
        return student;
    }

    //当使用时才加载
    private static class Inner{
        private static final Student STUDENT = new Student();
    }
}
